<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/7/19
 * Time: 21:57
 */

namespace app\api\controller\v1;
use app\lib\exception\ThemeException;
use think\Controller;
use app\api\model\Theme as ThemeModel;

class Theme extends Controller
{
    public function getSimpleList($id = '')
    {
        $validate = Validate('IdCollection') -> check(['id' => $id]);
        if(!$validate) return Validate('IdCollection') -> getError();
        $ids = explode(',', $id);
        $result = Model('Theme') -> getSimpleList($ids);
        if(!$result) throw new ThemeException();
        return $result;
    }
//    获取商品的表数据
    public function getComplexOne($id = '')
    {
        $validate = Validate('IdCollection') -> check(['id' => $id]);
        if(!$validate) return Validate('IdCollection') -> getError();
        $result = Model('Theme') -> getComplexOne($id);
        if(!$result) throw new ThemeException();
        return $result;
    }
}